/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.childcare.entities;

import com.aptech.childcare.buz.ChildcareBuz;
import com.aptech.childcare.components.PropertyIndex;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Xuan Hieu
 */
public class ClassChild implements PropertyIndex {

    private int classID = -1;
    private int ageGroupID;
    private String name;
    private String NameAge;
    private String note;
    private String lastError;
    ChildcareBuz buz = new ChildcareBuz();

    /**
     * @return the classID
     */
    public int getClassID() {
        return classID;
    }

    /**
     * @param classID the classID to set
     */
    public void setClassID(int classID) {
        this.classID = classID;
    }

    /**
     * @return the ageGroupID
     */
    public int getAgeGroupID() {
        return ageGroupID;
    }

    /**
     * @param ageGroupID the ageGroupID to set
     */
    public void setAgeGroupID(int ageGroupID) {
        this.ageGroupID = ageGroupID;
    }

    /**
     * @return the Name
     */
    public String getName() {
        return name;
    }

    /**
     * @param Name the Name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the lastError
     */
    public String getLastError() {
        return lastError;
    }

    /**
     * @param lastError the lastError to set
     */
    public void setLastError(String lastError) {
        this.lastError = lastError;
    }

    /**
     * @return the note
     */
    public String getNote() {
        return note;
    }

    /**
     * @param note the note to set
     */
    public void setNote(String note) {
        this.note = note;
    }

    public Object getPropertyValue(int index) {
        try {
            String value = "";
            NameAge = buz.findByIDAge(this.getAgeGroupID()).getAgeGroup();
            switch (index) {
                case 1:
                    value = String.valueOf(this.getClassID());
                    break;
                case 2:
                    value = this.getName();
                    break;
                case 3:
                    value = this.NameAge;
                    break;
                case 5:
                    value = String.valueOf(this.getAgeGroupID());
                    break;
                case 4:
                    value = this.getNote();
                    break;
            }
            return value;
        } catch (IOException ex) {
            Logger.getLogger(ClassChild.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    public void setPropertyValue(int index, Object value) {
    }

    public Class getPropertyClass(int index) {
        return String.class;
    }

    /**
     * @return the NameAge
     */
    public String getNameAge() {
        return NameAge;
    }

    /**
     * @param NameAge the NameAge to set
     */
    public void setNameAge(String NameAge) {
        this.NameAge = NameAge;
    }
}
